modified to make the dimension configurable. the code is well-written, so all i
needed to do was change the constants to use a class variable. try dim = 5!