Added basic error handling inside sub-modules with throw statements
Bug fixes