more cleanups + optimized error messages