merge pesi into master 

pesi fxns mostly done, prob a few tweaks to do