refactor for shorter code