pretty types and some refactoring