further optimizations/reorganizing