Added support for redmine 2.x

also some refactorings applyed