Refactor prepare and create commands.
Merge branch 'refactor_internals' into dummy_branch