added tests and scripts for testing. minor changes