tidying up small pieces of code. and tree