Hopefully finished code.