Credentials check + refractoring