Eh, changed it to use the already made fucntions instead of copypasta
Possibly thread safeness flag added to memory manager; has not been tested yet