Refactored some things, implemented some missing steps, etc.