Added comments and changed variable naming

Made things a little bit more understandable.