Added some awful, stateful, functions