Restructured functions

Restructured functions in Input.js
Comments added
Restructured functions