Added cal and input functions