first stab at full implementation