refactored tos editor