works more smoothly still need to fix agent