Optimized code
Added Documentation