Refactored command handler API in order to avoid cyclic dependencies