added algo for dealing with aces