Make the code a bit more DRY