Several optimisations & bug fixes
Optimisations
Session code replaced to reduce blocking (useful for multiple requests)