refactoring, extract class for input parsing