Refactor module into prefered pattern

This avoids much of the hard coded dependencies and makes things more
testable. Not to write more tests and document things like changing the
admin password and the port.