Added some javascipt magic