Refactor rendering method of background image