Refactor - format and remove useless dead code