Creating value object in function