various pieces of Javascript code