Steve Witham's lock solution