Optimize server code and implement cat_file interface.