Added tests
Added module specific exceptions
Important refactor to the code