updated main functions .