Remove --upgrade for pip since causes problems.

The latest bundling scripts breaks if --upgrade is there, I don't know
the reason but since we clone the repo each time and install in a clean
virtualenv this option shouldn't be necessary.

Do some code styling and code refactoring.
Work in progress...