surround a buncha stuff with replace;true and closures
fix indentation & consistent `var app =` usage