change hard code to mvc pattern