Added some missing functions
Some improvements