Rewrite this again. Getting ridiculous now.