Fixed typos
Removed debug messages and fixed typo
Improved use of flags in debug messages
Fixed typo
Fixed logic
Added lint checks and fixed lint errors
Commited changes