More integration of Lukata's code