Clean up api + Heap size fix