Moved functions to own file