from watermelon solution, almost understand