Merging Jia's code into the main app