Added regions to fold and organize code better.