refactored rust object constructor