Refactoring and updated to work with redmine 2.3.x