improve the relavent code