Minor corrections and code cleanup