snippet code tidying