minor changes and removed most warnings