refactorings
more type annotations added