Cleans up functions