Proper code reorganization this time. I think.