Modified algorithm for creating potential field
Fixd bug with potential fields