Implemented correct authentication protocol.  Also removed unused files and made some minor tweaks.