Finished up most of the work - just requires some cleanup re the normal() function