improving the code flow

added new color and fixed algorithms