Finishing first pass at new code