Improved documentation in README
Added extension parameter and improved code