no leaks and cleaned up code