implemented input handling