Marc/Ian: printing to file on certain events