Removed duplicated code.