adjust code based on comments