Importing some more code from other implementations