add testing and code fixes

@jwolski @mranney 

If curious, i'll pull myself by AM.