Added read input function with debounce, removed unused definitions, functions.