Split to different files
Added some logging