Fixed failing tests and added new ones.