made nicer code