optimized several things