Completed mostly extraction into a simple lib