Some small changes to the implementation