more tests, cleaner code