Eliminating errors and code smells