Refactor a code a bit.