Fixed javascript adding names and also correct class saving