Removed +1 on num_parts due to off by one error.
Re-raising exceptions so program exits with status codes