Tyding up the code