Refactored the class and added better error handling
Added readme