created cart controller and moved cart functions to it.