Fixing Program.cs to populate a IHostingEnvironment service

Also contains a general cleanup.