implement the 4 functions