cleaned up samebasis implementation and refactored code to utilize it instead of generic comparisons