Re-factored code because testing was proving difficult. Have disabled tests for now.