NB: This is moved code + variable rename only.