fixing syntax errors and adding tests