added some comments denoted as "# PW:"