DRY up code a bit more