converted #4 over from javascript and committing it