refactoring of the general controller behaviour + unit-tests