Dialyzer and refactoring

I moved a whole bunch of code from boss_web_controller to other modules, added a bunch of "-spec" to files (work in progress) and split up a bunch of big functions into smaller chunks.