Using scala try