add bug model interface

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>
update unittests, fix bugs found

Signed-off-by: Adam Stokes <adam.stokes@ubuntu.com>