Making the javascript for adding a bit more strict