try avoiding code repetition