Refactoring controller factories; Adding controller test cases