split implementation into 3 files