refactor checkIn function and dry up code