Updated API: Split into fragement and compile function
Updated JS
Updated example to reflect API change