Created Model and Controller

Moved all the codes in correct areas.