completed o- function