Tidy up, and start on dynamic allocation of data