Improve xlock

Improve xlock. Also include a few fixes.