view refactoing in progress
unstable version, need more test