test the amend func
Refactored it a bit, removed useless part of code and added comment so that it's more readable