simpler function snippets for js