modularized functions and created new alg for determining width relation...

...ships