Refactored and added new tests for calculating advantage