From https://github.com/silvestreh/onScreen/fork