fix the proportional tagging and refactor in it's own function

* fix the indentation in the proportional tagging function 
* move the code logic in it's own function