Code cleanup

+Minor optimisations