Added Javadocs, put some strings before the .equals, catched more specific exceptions and finally replaced a few tabs by spaces.