Bug fixes and removed unused files