small code improvements, makes sketch easier to understand