created a forum class and reduce number of codes