Added UT. Minor fixes.