make code more generic