refactoring for https://github.com/NodeBB/NodeBB/issues/1570

sorry @cnvo, this might cause you some trouble :(