I need to douse this code with some Active Record lovin'