Correctly build image URI for css

Also some abstracting and cleaning