Fixed a million small bugs added suring blind-refactoring
Added API tests