Background image support and changes to the order and comparisons of the ifs.
Added a size undefined in case all options have not been added.