Removed var_dump
move object instantiation logic to method