New problem solved, now in pascal