add some optimisations and functionalities