added some functionality from the original