Fixed up some code smells and moved over to registry