tidy code and adjust arguments