Added code coverage check

Thanks to @dylanb

---

Plus fixed a couple of small bugs.