moved functions to seperate file