functions updated with real code.