added a function to switch objects (still not working)