split big functions into smaller chunks and replaced ring arc with drawImage in an effort to get rid of the lag in Chrome