refactoring to allow input of multiple lines