Clearly been awhile since I worked on this code...