updated with Trevor's code to see if it elminates a js error