added thread optimations and class grouping by packages