Adding documentation

And removing magic numbers