Make less calls to malloc and friends. WIP