partial fix to esn issues
Code tidy, removing a few unused bits and adding some commenting
Merge branch 'development' pulling cleaner code