Nicer messages, some refactoring