refactoring + type additions