fix broken feature specs and code cleanup