Cleaned some code and added Comments