complete function implemented