Finished modulizing the code