Implemented changes suggested by tdanford.
Added missing license header.
Trying to simplify and clean up the tests.