move app js code to just main pattern file