restructuring and new functions