Removed business rules from HTML, various scope fixes