Making code generic