Added support for running as a windows service