moved functions from pan0 to utils