Fixed warnings, Performance optimisations