js list functions optimized