Added changes according to tackat's suggestions.