Broke up model and plugin code