Tested and modified