Line calculation implemented as cloose mentioned. Use constants for readability