several new functions added and small changes to several existing functions