Updated to try and export to module.exports if it's available.