Bored during a meeting

* Moved functions outside of main()
* Code clean-up
* Added multiple thread capability
* Added ceiling for the number of threads