Made major changes by splitting into modules. Also created new test file