Adding more tests and extracting more code