Allow Late Piety, Reformatting

If the AI has a religion now, it will be more likely to choose Piety,
even if it's later in the game. Also, some code has been cleaned up to
look nicer.