refact with login feature