Lots of updates to preliminary code