refactor computer function