Refactor and small fix