Writing, for me, is a little like wood carving. You find the lump of tree (the big central theme that gets you started), and you start cutting the shape that you think you want it to be. But you find, if you do it right, that the wood has a grain of its own (characters develop and present new insights, concentrated thinking about the story opens new avenues). If you're sensible, you work with the grain and, if you come across a knot hole, you incorporate that into the design. This is not the same as 'making it up as you go along'; it's a very careful process of control.