Sort of fixed some memory issues