Fixed algorithm (no longer using Array.slice for copy)
Added control panel for debugging