arrays problem refactored and bonus component completed