continued #33, added length check for carousel