all warnings fixed, optimized compilation