reduce code by using getattr magic method instead of explicit command
functions