Add logout handler.

User prepared statements consistently.