Minor refactoring and function renaming in espruino code