Fixed assignment bug in cell_add and moved geometry functions to separate file.