Implemented tex replacement magic