Warnings removed and code cleanup