seperate out into different functions