code refactored & new features added