Made copy of RMQ's template, then many mods. I haven't tested this yet