added assoc prof Fridli's changes
fixed some errors
fixed missing testfunction