Modified main script to detect CommonJS