Refactored and removed some old unused files