imported some Craiganese

imported some useful functions written by Craig and Json