New Tests, some code refactor