Cleaned up code + small bug fixes
Cleaned up code and minor bug fixes