pass red green blue by reference and remove the local variables