small refactoring for better readability
lots of tests for cf_messages_controller