Fixed warnings and some excellent programming