Refactor

some minor improvements