Renamed and fixed some code issues