Need explanation of script

Hi
All,

Can anybody explain what this script is doing?

#!/bin/sh
who | cut -d " " -f1 | sort -u > userlist1
while true ; do
sleep 60
who | cut -d" " -f1 | sort -u >userlist2
for username in `cat userlist1` ; do
if ! grep "^$username$" userlist2 > /dev/null ; then
echo "$username has logged out"
fi
done
for username in `cat userlist2` ; do
if ! grep "^$username$" userlist1>/dev/null; then
echo "$username hass logged in"
done
mv userlist2 userlist1;
done

Thanks,
Vishal