Avoid GWT depedency by bringing simplified dir estimate logic

I just thought GWT depedency just for dir estimation is overkill so thought is better to port and simplify it for here. Please review the changes and let me know if it has any problem. Thank you