Fixed up some functions to be nicer.