added entity generation code