Remove old code and move stuff into helpers.js