clean up and fixed some issues.