Improve tests and readability