Added marks support. Probably will have to be rewritten to use
grouped elements.