also store rules in session
remove params to main
reduce amount of arg passing