Enabled user input.

Seperated the algorithm into several functions to modularize it.