General useful functions for many programs