Misc stuff (mainly old code for reference)