completed building both function