implemented mvc pattern