Final Whitney fix. Tested and works. #527

Looks ugly in the code but screw this. TODO: Rewrite shit later.