Allow compilation for files with multiple extensions

The tests pass, but I still think this might need some peer review.