Updated function using solve