optimized a little bit