trying different curves
moving common code to shared.js
fixing mem