Refactored the test from index