refactored to use asObject