Small modifications to make it work