Code translated from HUN to ENG