Moved functions to seperate file