Finished reorganizing code.