added some useful functions, improved performance