Re-factor the code to make it clearer.