Gives error numbers and refactored