Added new tests, improved flexibility