Rearranged analysis code into library and added hybrid analysis