Switch to cbv and code cleanup