First implementation
Bug fix: typo
Update with comments