refactir redendancy