Added comments, changed some var names