rewrote couple of things. Tested against redmine for closing versions