Broad fixes to Remove* functions
Added draft of variable compartment code. See issue #4.