Adding documentation and clarifying variables