refactoring input parser - 2nd iteration