refactored implementation into seperate scala folder