updated PRE code - need to finish