add unit tests for, and refine View