solutions without exception handling