First versions of javascript functions