Extracting view logic