Refactored to a better setup
Added some minor modifications