added test and debugging