code cleanup and login working