JS is just plain ugly sometimes.