changed some stuff, rewriting js