Made code generic