Refactoring code and Studying VisJS physics