Refactored code and added interactive mode
working on it