PE78 solved - algorithm improved