Refactored core API to a package; Updated tests