after some modifications