improved documentation of javascript functions