Checkpoint for PHP widget.
Misc. refactorings.