Base from the Melon.js tutorial