remove unused code
add _session and _cookie function