added all the code behind each operation