Organized code and elaborated on comments