refactor to use provider
add support for css backgrounds and custom parents