Fixing logic and acceptance tests