final fixes and test case
code beautification