changing function definition to use RGB array from main