Shuffled around some more code. Added more funcs.