Refactored from mvc to mvvm pattern (fits better to ractive templates).