More tests and changes to accomodate those tests/fix bugs.