fixed syntax errors and added tests