Refactored Main method to resolve issue running as upstart service on Ubuntu.