Initial import from Marek Goldmann <https://github.com/goldmann>