This code is complex to read compared as to what it does.