Added a setColor function to make the code neater