rewritten synopsis and added tests and testing framework