rebuild and fix logic and status bugs