some optimisations + clean