sorting out code