fixed warnings and cleaned code