Feature/127 write to file as extension

This PR fixes issue #127