major changes to pyramid.js. backed up old version for ref