Made fixes as per Andrei's suggestions.