Simplified code:
- Removed regions array
- Updated log messages
- Added error checking