Few code tidy ups and better distribution of code across libs