Implements 90% of stage 1 functionality.