outsourced js functions