Add unit tests
Fix lint errors
Fix most lint warnings