refactors, minor fixes