Refactored and removed errors
refactor