Finished extend function and tests