Some logical errors remain...