Rearranged test code to be in single method