refactor and cleanup text