refactored and added tests to CASSANDRA-7450