Code refactored and standardised