replaced the comafy function with new method