Added Tests And Refinement