Probably a better solution to previous issue