Sorry, can't help with the battery position other than to ask if the D31A is the right battery for a petrol JK?
I know the diesels use the D31A as I just bought one last week as my previous one died but I don't know if the petrols need the same battery.
In my JK the battery tray is shaped to fit the D31A so it drops straight in. If it's not fitting then that might indicated it's the wrong battery type. Just guessing though.
Oh, and it's great to see an engine bay that's dirtier than mine
PS Looks like I was pipped to the post. Got to be quick around here!