Added implementation for combinations function