some minor bugs weeded out