Refactors recommended by Zsolt implemented.