refactored as comments from @mdogan