made new functions to reduce repeative code