Fixed problems and code Cleanup.