functioning view refactoring