Fixed syntax errors and improve output