ugly javascript