applied the DRY principle