Type refactoring and some commenting