Refactoring. Seems stable.