improved the memory management aesthetics of the code a bit