condensed some code and removed unneccesary comments