cleanup and better impliment the mvc paradigm