refactored using slim