seperate 2d and 3d operations, add some functions for 2d