memory leaks and other nonsense has been fixed