line_item and cart scaffolds refactoring and some tiny optimizations