make the take and localstorage become function