Another complete re-write! yay.