Fixed some mistakes, raising exception and indentation.