Minor code changes to fix bugs and final testing criteria