Fixed warnings and did some cleanup