General editing. Removed numerous debug printf's