Lint

Merge back mgagne's 'grizzly' branch, fix some bugs & lint errors, add some tests.