Implemented 'analyze' API.
Added analyze tests.
Fixed tabs.
trying to merge