Move variables to the top section.
Implement correct mode exiting.
Remove wrong comments. Fix issue.
Remove wrong comment.