work version, handed to Dmitry