restructured classes into somewhat mvc model