miscellaneous code written in scala