Fix/Warnings Fixed logic and code warnings