minor refuctoring