made the code easier to debug

Change-Id: I4e02e4f03c5e1e7c535ad48e147e57576f01f5fe
fixed null pointer & binding errors

Change-Id: Iad60b6bdd32e1d5f5044e9dafd1c8d448d4853e8
now sorting by color data instead of rgb values

Change-Id: I53b4c2fff43588732fa5f3927f5e8252946edaca