Made the code a bit cleaner by removing and fixing warnings