Added commonjs support and fixed references function call