solve method added