used ruby methods to palce code into different methods