Useful functions posted by pds2k12