Added compiler warnings and code cleanup