Changes to main.

Fixed issue with user input of 9 giving wrong result.