merge changes from JoelOtter & kunev