Refactor fragment compiler and single root fragments