error, and some code cleanup