Added support for gemspec files
Refactored code