added exceptions and multiline support