Cleaned up code and Added Comments