a bit of math with a small transition bug - to fix in the park