Updated: +debug output; small modifications