moved object initialization into run function