updated to take variable 'a', not just two