added `extend` functionality

also added more verbose comments