refactor check user method