fixed uncaught type error & refactored some visual tools code