Enabled user input.
Seperated the algorithm into several functions to modularize it.
Merge pull request #1 from Shadowen/master

Enabled user input.