added 'Auto Draw' checkbox
added 'Auto Draw' function and refactored some code