New features added. Optimized code.