Refactored the code. Removed unnecessary imports. Moved everything into ers package.