Performance improvement
Minor error fixes