cleaned up code and commented stuff