refactored last login feature