Refactor this proc.
Merge pull request #803 from ESwordTheCat/7b#vbri1

Refactor this proc.