Refactoring of Controller, see issue #43