implementation of the focus functions plus mods to the tests so they pass on all platforms