Added partialy Zend/Magento-like getModel() and refactored some functions code