Use shared_ptr instead of the struct for position and dimension so I don't have to delete them