Removed all duplicate code.