Extract check-style module.

Also fix any checkstyle warnings and errors that were raised.

Fixes #2