moved functions into their own file.