added constructor for object instance

this constructor would help me a lot.

if you want me to change something, feel free to ask.