added "misc.py" for helper functions and classes