moved functions to its own file