refactory & writing