error fixes, optimizations
refactors