first attempt to shorten code