Replaced free/malloc with pico functions