changed entity constrcutor
changed entity key logic
add optional parameters
~ ~ ~ ~ ~