API improvements & cleaning up code