Fixed syntax errors and added more comments.