added more tests and abstraction