Code refactorization, improved /r/ trigger.