refactored, less code, better execution