Fixed unused variables and added comments.