refactor to use factory functino for penalty type