Improve some methods and tests