refucktoring layout js