Moodle and Wordpress updates

- Added comments
- Refactored code