Sorry for the crappy indenting.