Cleaned up code and added more comments. No code alterations