added others function and updated the whole code