More test refactoring.
Move the factory file.
Tests now pass.
Clean up apiserver.