Split files
Added test
refactoring