thread.jade refactored