Refactoring small fixes, small functionality