- improved pascal code