Major changes, refactor, tests added and API changes