refactoring to keep it more clean