Added some testing & Refactored