import optimizations and fixes