Removed some duplicate codes