some corrections and cleanup