refactor slightly add viewmodel