Fixed tests and added new feature