Removed modulai and did some refactoring