improved market controller removing logic from views, minor bug fixes