added input handling