Added secure middleware
Fixed up a few nits