Library of useful functions and classes