Initial commit of functions. This probably doesn't work right now