Refactor extraction logic

When extracting a tarball we will always keep the same file structure unless
the option 'flatten' is set to true
When its set to true all files will be extracted to the same directory

Some use cases can be that you want to extract all jar files from a tarball but
have them extracted in the same directory