Removed all code duplication