Adding error handling code and refactoring existing mr

moved the mr code to a different package to make it more logical.
Renamed all mr code to Generic*.
Also added basic error hadling code