patterns from Stoyan Stefanov