Finished modularizing; Added some documentation; Cleaned the code