Comments added, also changed some var names