Corrected an error, and some cleanup