Tidying crt code