Cleaned up given code and outlined pipeline steps.