Importing old code, so it can be rewritten according to Zdeva engine
rules.