optimized with static functions