added a few optamisations and geo code