Adds more improvements after comments from @QuLogic