Merging BoRyan's changes into mine.