moved functions to prototype