Refactor pattern pixel fetching a bit