reduces code duplication