first 4 hour attempt at the problem