Added constructor argument for dimensions, no support for dimensions other than 2 yet.