Working build - more tweaking required for better written code (custom events, event handler scope)