Fixed numerous small issues