Changed updatenextXYpossition

Used the array.some function for updating the nodes and plaing them,
also made some minor adjustments to math-probs with formatting