moved things into their own functions