FORUM-804: Refactor code