Fixed small bug (duplicate code removed).