Api normalize

This pull completes the functionality discussed in #239. 

I also added a bunch of tests for both new and existing functionality. Doing so several bugs in the existing code, one of which that I could not track down. I disabled its test and I will open a separate issue.