Removed logic bugs