Add logout_c function. Comment some more code.

Signed-off-by: Darshit Shah <darnir@gmail.com>