John branch

Seapating the input into separate functions.