updated distance calc to RGB space