limited refactoring
Used some lint
Fixed some warnings