tidying the code