changed my functions to be more ruby like