updated and works well