modified to allow it to work with other versions