Added pagination plugin for models. Some refactoring in controllers