[IMP] improved code and removedd some issue which raised during rebase.