Removed debug output
Added comments and some cleanups