Refactor prepare and create commands.