This needs to go into a separate class and needs to have an appropriate unit test.