Added default case to action switch statement: Bad request on unknown action. Again some refactoring and documenttion.