Further code extension, some rework