throw exceptions and check for files etc