fixed many issues and did some enhancements