adpted to changes by wrzuta