Fix typos and bugs
Refactor Tests