Moved functions into file