Improved API and removed copilationwq bugs