Dropped the top-level pat folder, removed NB project, added comments, added MIT license, various fixes and cleanup