organized code in chatter.php