Warnings fixes, code cleanup