This piece of code can be simplified. Let's refactor it later.