Terrible code that needs to change badly