refactor: drying up code