Further input improvements? And some refactoring