Tidying the code