Another refactoring. Everything works in play mode now.