Full code review

What is this 0.8 ? Don't use constants here, move them all in a separate function/object and give them meaningful names or add comments to explain what they are and where they come from.