added exceptions and stack