Made more use of javascript