formatting and removed unused $escape variable