Working current_pos code with debug tools included