Added exception and some comments