updated and functionalized