Add workshop/forum reset code and tidy up lib.php as per Moodle coding guidelines