change css function color and clean up code