XML loading, looking to fix logic