Back end logic added, but not working