refactored input class