Fixed all the broken tests. Need to do the pending tests next.