Refactor code a bit;