Refacored some files