2nd solution half-way