Update

Update after adding test cases and further improvements