Just a bunch of code I have found useful over the years