rewrite rgbtohsl function