cleanup, make learning and thinking recursive