Simpler solve method. Should port this back to the beginning.