eliminated code duplication