miscellaneous code and small scripts