refactored some service stuff using mono. Not tested
more minor fixes and refactoring in mono
test edit in c9.io