move object-building functions to separate file