updated code to work with melon.js 1.0 and som small fixes