Added a whole mess of functions