rewrite function that keep thumb in centre