cleaned up / refactored getObjects code