Improved a few of the miscellaneous functions