reformat and adding debugging
Cleanup the code a bit and fix types and add trial rotation
Merge pull request #1 from jeapostrophe/master

reformat and adding debugging