refactored by using let for user_id and drying up code