Refactored Code and Added functionality
other stuff too