Views for lessons, completed lessons table and refactoring