Complete function implemented