standardised the code a bit