Fixed up TheLoneDevil's changes.