Fleshing out tests, applying fixes