Refactored a bit and added an example of a controller test