Add several new function a clean up code