Updated the core of the code to work with express 4.*