Added pseudo-authentication. Some bug fixies and other improvements.