The first thing you need to make your peace with when you’re writing an RPG module is that no plan survives contact with the players. Once you’ve realized that they will not only capture the Imperial survey vessel they’re sent to find but then auction it off to both their employers and it’s previous owners (This happened) then you have nothing to fear. Especially if you set a clue tree.
Think of clue trees like maps only you need to follow. They start with the inciting incident for the adventure, branch out to the first few leads, anticipate the responses the characters will have and keep going until you get to the end of the story. So, for example:
And on we go. Every adventure is both a puzzle and a fight. The puzzle is for you to set and the characters to solve. The fight is between their idea to beat a witness to death with another one (This happened) or to ignore the adventure completely and go on an impromptu tour of a new city (This also happened).
The clue tree helps you improvise, gives you the freedom to let them do some of the hopefully non stupid, terrifying or lethal stuff they want to do and most importantly lets you set the adventure in your own mind. You will be much, much better at improv than you think you are. If you have the structure of the adventure in your mind then you can slot stuff in in new places like a caffeinated Lego blackbelt. So, go plant some clue trees.