Preparation for cluster support

 - Added a bunch of unit test for configuration handling code
 - Finalize all the things
 - Use generified commands

Again as above. It is not blocker but I think sometimes readability hurts