Improved some functions