Removed unneeded code and fixed warning